<!-- HTML header for doxygen 1.9.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>COMMONS-NET: commonsNet.tftp.TFTPPacket类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">COMMONS-NET
   </div>
  </td>
    <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <span id="MSearchSelect"                onmouseover="return searchBox.OnSearchSelectShow()"                onmouseout="return searchBox.OnSearchSelectHide()">&#160;</span>
          <input type="text" id="MSearchField" value="" placeholder="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('classcommonsNet_1_1tftp_1_1TFTPPacket.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-attribs">Public 属性</a> &#124;
<a href="#pac-methods">包函数</a> &#124;
<a href="#pri-attribs">Private 属性</a> &#124;
<a href="classcommonsNet_1_1tftp_1_1TFTPPacket-members.html">所有成员列表</a>  </div>
  <div class="headertitle"><div class="title">commonsNet.tftp.TFTPPacket类 参考</div></div>
</div><!--header-->
<div class="contents">

<p>TFTPPacket 是一个抽象类，封装了五种类型的 TFTP 数据包共有的功能。它还提供了一个静态工厂方法，用于根据数据报创建正确的 TFTP 数据包实例。  
 <a href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#details">更多...</a></p>
<div class="dynheader">
类 commonsNet.tftp.TFTPPacket 继承关系图:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classcommonsNet_1_1tftp_1_1TFTPPacket.png" usemap="#commonsNet.tftp.TFTPPacket_map" alt=""/>
  <map id="commonsNet.tftp.TFTPPacket_map" name="commonsNet.tftp.TFTPPacket_map">
<area href="classcommonsNet_1_1tftp_1_1TFTPAckPacket.html" title="TFTPAckPacket 是从 TFTPPacket 派生的类，定义了 TFTP 确认数据包类型。" alt="commonsNet.tftp.TFTPAckPacket" shape="rect" coords="0,56,249,80"/>
<area href="classcommonsNet_1_1tftp_1_1TFTPDataPacket.html" title="TFTPAckPacket 是从 TFTPPacket 派生的类，定义了 TFTP 数据数据包类型。" alt="commonsNet.tftp.TFTPDataPacket" shape="rect" coords="259,56,508,80"/>
<area href="classcommonsNet_1_1tftp_1_1TFTPErrorPacket.html" title="TFTPErrorPacket 是从 TFTPPacket 派生的类，定义了 TFTP 错误包类型。" alt="commonsNet.tftp.TFTPErrorPacket" shape="rect" coords="518,56,767,80"/>
<area href="classcommonsNet_1_1tftp_1_1TFTPRequestPacket.html" title="TFTPRequestPacket 是从 TFTPPacket 派生的类，定义了 TFTP 请求数据包类型。" alt="commonsNet.tftp.TFTPRequestPacket" shape="rect" coords="777,56,1026,80"/>
<area href="classcommonsNet_1_1tftp_1_1TFTPReadRequestPacket.html" title="TFTPReadRequestPacket 是从 TFTPPacket 派生的类，定义了 TFTP 读取请求数据包类型。" alt="commonsNet.tftp.TFTPReadRequestPacket" shape="rect" coords="647,112,896,136"/>
<area href="classcommonsNet_1_1tftp_1_1TFTPWriteRequestPacket.html" title="TFTPWriteRequestPacket 是从 TFTPPacket 派生的类，定义了 TFTP 写请求数据包类型。" alt="commonsNet.tftp.TFTPWriteRequestPacket" shape="rect" coords="906,112,1155,136"/>
  </map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a449be75d783028d271f3e1af62f970a9"><td class="memItemLeft" align="right" valign="top">public static func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#a449be75d783028d271f3e1af62f970a9">newTFTPPacket</a> (datagram: Array&lt;Byte&gt;, address: String, port: UInt16): <a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html">TFTPPacket</a></td></tr>
<tr class="memdesc:a449be75d783028d271f3e1af62f970a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">当接收到一个预期为 TFTP 数据包的数据报时，使用此工厂方法创建正确的 TFTPPacket 对象，封装在该数据报中的数据。  <br /></td></tr>
<tr class="separator:a449be75d783028d271f3e1af62f970a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af865694cdd78af54d3d0775a887cf5ed"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#af865694cdd78af54d3d0775a887cf5ed">getAddress</a> (): String</td></tr>
<tr class="memdesc:af865694cdd78af54d3d0775a887cf5ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取数据包的来源或将要发送的目标主机地址。  <br /></td></tr>
<tr class="separator:af865694cdd78af54d3d0775a887cf5ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a27e7a619dfec5ab08d65079a57c58657"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#a27e7a619dfec5ab08d65079a57c58657">getPort</a> (): UInt16</td></tr>
<tr class="memdesc:a27e7a619dfec5ab08d65079a57c58657"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取数据包的来源或将要发送的目标端口。  <br /></td></tr>
<tr class="separator:a27e7a619dfec5ab08d65079a57c58657"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0ac725cc37ddee6a29e93c6d16205f73"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#a0ac725cc37ddee6a29e93c6d16205f73">getPacketType</a> (): Int64</td></tr>
<tr class="memdesc:a0ac725cc37ddee6a29e93c6d16205f73"><td class="mdescLeft">&#160;</td><td class="mdescRight">返回数据包的类型。  <br /></td></tr>
<tr class="separator:a0ac725cc37ddee6a29e93c6d16205f73"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5e78b2bfd31eec2d9b33ead235374370"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#a5e78b2bfd31eec2d9b33ead235374370">newData</a> (): Array&lt;Byte&gt;</td></tr>
<tr class="memdesc:a5e78b2bfd31eec2d9b33ead235374370"><td class="mdescLeft">&#160;</td><td class="mdescRight">创建一个正确格式的 TFTP 数据包数据。  <br /></td></tr>
<tr class="separator:a5e78b2bfd31eec2d9b33ead235374370"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a027e8d3541a9ff74cf75639a1251d092"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#a027e8d3541a9ff74cf75639a1251d092">setAddress</a> (address: String): Unit</td></tr>
<tr class="memdesc:a027e8d3541a9ff74cf75639a1251d092"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置数据包要发送到的主机地址。  <br /></td></tr>
<tr class="separator:a027e8d3541a9ff74cf75639a1251d092"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab907b12cf65da8783e9dfb81ea18e5c4"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#ab907b12cf65da8783e9dfb81ea18e5c4">setPort</a> (port: UInt16): Unit</td></tr>
<tr class="memdesc:ab907b12cf65da8783e9dfb81ea18e5c4"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置数据包要发送的端口。  <br /></td></tr>
<tr class="separator:ab907b12cf65da8783e9dfb81ea18e5c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4aad5bc8e980f2256d2bbe3baa9d746b"><td class="memItemLeft" align="right" valign="top">public open func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#a4aad5bc8e980f2256d2bbe3baa9d746b">toString</a> (): String</td></tr>
<tr class="memdesc:a4aad5bc8e980f2256d2bbe3baa9d746b"><td class="mdescLeft">&#160;</td><td class="mdescRight">用于调试，返回对象的字符串表示，包括地址、端口、类型。  <br /></td></tr>
<tr class="separator:a4aad5bc8e980f2256d2bbe3baa9d746b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-attribs" name="pub-attribs"></a>
Public 属性</h2></td></tr>
<tr class="memitem:a1b9d01dc44fc4d498b613e4c8f0b606d"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#a1b9d01dc44fc4d498b613e4c8f0b606d">static let READ_REQUEST</a> = 1;</td></tr>
<tr class="memdesc:a1b9d01dc44fc4d498b613e4c8f0b606d"><td class="mdescLeft">&#160;</td><td class="mdescRight">TFTP 规范标识符，等于1。 <code><a class="el" href="">getType()</a></code> 返回的标识符，表示读请求数据包。  <br /></td></tr>
<tr class="separator:a1b9d01dc44fc4d498b613e4c8f0b606d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae400dc7ae167e2886890feefe6b9385e"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#ae400dc7ae167e2886890feefe6b9385e">static let WRITE_REQUEST</a> = 2;</td></tr>
<tr class="memdesc:ae400dc7ae167e2886890feefe6b9385e"><td class="mdescLeft">&#160;</td><td class="mdescRight">TFTP 规范标识符，等于2。 <code><a class="el" href="">getType()</a></code> 返回的标识符，表示写请求数据包。  <br /></td></tr>
<tr class="separator:ae400dc7ae167e2886890feefe6b9385e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8f98d56c20097453a986157c881bf5ea"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#a8f98d56c20097453a986157c881bf5ea">static let DATA</a> = 3;</td></tr>
<tr class="memdesc:a8f98d56c20097453a986157c881bf5ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">TFTP 规范标识符，等于3。 <code><a class="el" href="">getType()</a></code> 返回的标识符，表示数据数据包。  <br /></td></tr>
<tr class="separator:a8f98d56c20097453a986157c881bf5ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aef344f92fab5c92ba4cc7794804bbbc0"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#aef344f92fab5c92ba4cc7794804bbbc0">static let ACKNOWLEDGEMENT</a> = 4;</td></tr>
<tr class="memdesc:aef344f92fab5c92ba4cc7794804bbbc0"><td class="mdescLeft">&#160;</td><td class="mdescRight">TFTP 规范标识符，等于4。 <code><a class="el" href="">getType()</a></code> 返回的标识符，表示确认数据包。  <br /></td></tr>
<tr class="separator:aef344f92fab5c92ba4cc7794804bbbc0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa636305b5ea4afa869b03bdad53fa2e9"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#aa636305b5ea4afa869b03bdad53fa2e9">static let ERROR</a> = 5;</td></tr>
<tr class="memdesc:aa636305b5ea4afa869b03bdad53fa2e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">TFTP 规范标识符，等于5。 <code><a class="el" href="">getType()</a></code> 返回的标识符，表示错误数据包。  <br /></td></tr>
<tr class="separator:aa636305b5ea4afa869b03bdad53fa2e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae23de23646555553bcebb5a748af38c5"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#ae23de23646555553bcebb5a748af38c5">static let SEGMENT_SIZE</a> = 512;</td></tr>
<tr class="memdesc:ae23de23646555553bcebb5a748af38c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">TFTP 数据包的最大段大小，为 512 字节。  <br /></td></tr>
<tr class="separator:ae23de23646555553bcebb5a748af38c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pac-methods" name="pac-methods"></a>
包函数</h2></td></tr>
<tr class="memitem:ad3f5a4b401a490faa07781b1565a6b74"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#ad3f5a4b401a490faa07781b1565a6b74">init</a> (packettype: Int64, address: String, port: UInt16)</td></tr>
<tr class="memdesc:ad3f5a4b401a490faa07781b1565a6b74"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造一个 TFTPPacket 对象。  <br /></td></tr>
<tr class="separator:ad3f5a4b401a490faa07781b1565a6b74"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-attribs" name="pri-attribs"></a>
Private 属性</h2></td></tr>
<tr class="memitem:af92d9972a0c06888d9d035a474ce9811"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#af92d9972a0c06888d9d035a474ce9811">static let MIN_PACKET_SIZE</a> = 4;</td></tr>
<tr class="memdesc:af92d9972a0c06888d9d035a474ce9811"><td class="mdescLeft">&#160;</td><td class="mdescRight">数据包的最小大小，为4个字节。足够存储操作码和块号或其他必需的数据，具体数据包大小取决于数据包类型。  <br /></td></tr>
<tr class="separator:af92d9972a0c06888d9d035a474ce9811"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07c6d1b18aac77659150f70b9ee91e96"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#a07c6d1b18aac77659150f70b9ee91e96">var packettype</a> : Int64 = 0;</td></tr>
<tr class="memdesc:a07c6d1b18aac77659150f70b9ee91e96"><td class="mdescLeft">&#160;</td><td class="mdescRight">数据包的类型。  <br /></td></tr>
<tr class="separator:a07c6d1b18aac77659150f70b9ee91e96"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af5ba7e699cd0b2c8cb2a70ab81bd800c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#af5ba7e699cd0b2c8cb2a70ab81bd800c">var port</a> : UInt16 = 0;</td></tr>
<tr class="memdesc:af5ba7e699cd0b2c8cb2a70ab81bd800c"><td class="mdescLeft">&#160;</td><td class="mdescRight">数据包的目标或来源使用的端口。  <br /></td></tr>
<tr class="separator:af5ba7e699cd0b2c8cb2a70ab81bd800c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a52ba3da7a0bb6c6109adf8991feeba70"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html#a52ba3da7a0bb6c6109adf8991feeba70">var address</a> : String = &quot;&quot;;</td></tr>
<tr class="memdesc:a52ba3da7a0bb6c6109adf8991feeba70"><td class="mdescLeft">&#160;</td><td class="mdescRight">数据包的目标或来源主机地址。  <br /></td></tr>
<tr class="separator:a52ba3da7a0bb6c6109adf8991feeba70"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>TFTPPacket 是一个抽象类，封装了五种类型的 TFTP 数据包共有的功能。它还提供了一个静态工厂方法，用于根据数据报创建正确的 TFTP 数据包实例。 </p>
<p>这样可以避免程序员自己去解析数据报中包含的 TFTP 数据包类型，并手动创建它。 TFTP协议的详细信息和 TFTP 数据包的格式可以在 RFC 783 中找到。</p>
<dl class="section see"><dt>参见</dt><dd>TFTPPacketException </dd>
<dd>
TFTP </dd></dl>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="ad3f5a4b401a490faa07781b1565a6b74" name="ad3f5a4b401a490faa07781b1565a6b74"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad3f5a4b401a490faa07781b1565a6b74">&#9670;&#160;</a></span>init()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.init </td>
          <td>(</td>
          <td class="paramname"><em>packettype</em>:&#160;</td>
          <td class="paramtype">Int64, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramname"><em>address</em>:&#160;</td>
          <td class="paramtype">String, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramname"><em>port</em>:&#160;</td>
          <td class="paramtype">UInt16&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">package</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>构造一个 TFTPPacket 对象。 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">type</td><td>数据包的类型 </td></tr>
    <tr><td class="paramname">address</td><td>数据包的来源或将要发送的目标主机地址 </td></tr>
    <tr><td class="paramname">port</td><td>数据包的来源或将要发送的目标端口 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="af865694cdd78af54d3d0775a887cf5ed" name="af865694cdd78af54d3d0775a887cf5ed"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af865694cdd78af54d3d0775a887cf5ed">&#9670;&#160;</a></span>getAddress()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public func commonsNet.tftp.TFTPPacket.getAddress </td>
          <td>(</td>
          <td class="paramtype"></td><td>)</td>
          <td>: String </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>获取数据包的来源或将要发送的目标主机地址。 </p>
<dl class="section return"><dt>返回</dt><dd>地址对应的字符串 </dd></dl>

</div>
</div>
<a id="a0ac725cc37ddee6a29e93c6d16205f73" name="a0ac725cc37ddee6a29e93c6d16205f73"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0ac725cc37ddee6a29e93c6d16205f73">&#9670;&#160;</a></span>getPacketType()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public func commonsNet.tftp.TFTPPacket.getPacketType </td>
          <td>(</td>
          <td class="paramtype"></td><td>)</td>
          <td>: Int64 </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>返回数据包的类型。 </p>
<dl class="section return"><dt>返回</dt><dd>数据包的类型。 </dd></dl>

</div>
</div>
<a id="a27e7a619dfec5ab08d65079a57c58657" name="a27e7a619dfec5ab08d65079a57c58657"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a27e7a619dfec5ab08d65079a57c58657">&#9670;&#160;</a></span>getPort()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public func commonsNet.tftp.TFTPPacket.getPort </td>
          <td>(</td>
          <td class="paramtype"></td><td>)</td>
          <td>: UInt16 </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>获取数据包的来源或将要发送的目标端口。 </p>
<dl class="section return"><dt>返回</dt><dd>端口号 </dd></dl>

</div>
</div>
<a id="a5e78b2bfd31eec2d9b33ead235374370" name="a5e78b2bfd31eec2d9b33ead235374370"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5e78b2bfd31eec2d9b33ead235374370">&#9670;&#160;</a></span>newData()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public func commonsNet.tftp.TFTPPacket.newData </td>
          <td>(</td>
          <td class="paramtype"></td><td>)</td>
          <td>: Array&lt;Byte&gt;</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>创建一个正确格式的 TFTP 数据包数据。 </p>
<dl class="section return"><dt>返回</dt><dd>正确格式的 TFTP 数据包数据 </dd></dl>

</div>
</div>
<a id="a449be75d783028d271f3e1af62f970a9" name="a449be75d783028d271f3e1af62f970a9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a449be75d783028d271f3e1af62f970a9">&#9670;&#160;</a></span>newTFTPPacket()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public static func commonsNet.tftp.TFTPPacket.newTFTPPacket </td>
          <td>(</td>
          <td class="paramname"><em>datagram</em>:&#160;</td>
          <td class="paramtype">Array&lt;Byte&gt;, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramname"><em>address</em>:&#160;</td>
          <td class="paramtype">String, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramname"><em>port</em>:&#160;</td>
          <td class="paramtype">UInt16&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>: <a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html">TFTPPacket</a> </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>当接收到一个预期为 TFTP 数据包的数据报时，使用此工厂方法创建正确的 TFTPPacket 对象，封装在该数据报中的数据。 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">datagram</td><td>TFTP 数据包内的数据 </td></tr>
    <tr><td class="paramname">address</td><td>数据对应的地址 </td></tr>
    <tr><td class="paramname">port</td><td>数据对应的端口号 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>对应于数据的 TFTPPacket 对象 </dd></dl>
<dl class="exception"><dt>异常</dt><dd>
  <table class="exception">
    <tr><td class="paramname">TFTPPacketException</td><td>如果数据报不包含有效的 TFTP 数据包 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a027e8d3541a9ff74cf75639a1251d092" name="a027e8d3541a9ff74cf75639a1251d092"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a027e8d3541a9ff74cf75639a1251d092">&#9670;&#160;</a></span>setAddress()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public func commonsNet.tftp.TFTPPacket.setAddress </td>
          <td>(</td>
          <td class="paramname"><em>address</em>:&#160;</td>
          <td class="paramtype">String</td><td>)</td>
          <td>: Unit </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>设置数据包要发送到的主机地址。 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">address</td><td>要设置的地址。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ab907b12cf65da8783e9dfb81ea18e5c4" name="ab907b12cf65da8783e9dfb81ea18e5c4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab907b12cf65da8783e9dfb81ea18e5c4">&#9670;&#160;</a></span>setPort()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public func commonsNet.tftp.TFTPPacket.setPort </td>
          <td>(</td>
          <td class="paramname"><em>port</em>:&#160;</td>
          <td class="paramtype">UInt16</td><td>)</td>
          <td>: Unit </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>设置数据包要发送的端口。 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">port</td><td>要设置的端口。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a4aad5bc8e980f2256d2bbe3baa9d746b" name="a4aad5bc8e980f2256d2bbe3baa9d746b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4aad5bc8e980f2256d2bbe3baa9d746b">&#9670;&#160;</a></span>toString()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public open func commonsNet.tftp.TFTPPacket.toString </td>
          <td>(</td>
          <td class="paramtype"></td><td>)</td>
          <td>: String </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>用于调试，返回对象的字符串表示，包括地址、端口、类型。 </p>
<dl class="section return"><dt>返回</dt><dd>返回表示对象的字符串 </dd></dl>

</div>
</div>
<h2 class="groupheader">类成员变量说明</h2>
<a id="aef344f92fab5c92ba4cc7794804bbbc0" name="aef344f92fab5c92ba4cc7794804bbbc0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aef344f92fab5c92ba4cc7794804bbbc0">&#9670;&#160;</a></span>static let ACKNOWLEDGEMENT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.static let ACKNOWLEDGEMENT = 4;</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>TFTP 规范标识符，等于4。 <code><a class="el" href="">getType()</a></code> 返回的标识符，表示确认数据包。 </p>

</div>
</div>
<a id="a8f98d56c20097453a986157c881bf5ea" name="a8f98d56c20097453a986157c881bf5ea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8f98d56c20097453a986157c881bf5ea">&#9670;&#160;</a></span>static let DATA</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.static let DATA = 3;</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>TFTP 规范标识符，等于3。 <code><a class="el" href="">getType()</a></code> 返回的标识符，表示数据数据包。 </p>

</div>
</div>
<a id="aa636305b5ea4afa869b03bdad53fa2e9" name="aa636305b5ea4afa869b03bdad53fa2e9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa636305b5ea4afa869b03bdad53fa2e9">&#9670;&#160;</a></span>static let ERROR</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.static let ERROR = 5;</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>TFTP 规范标识符，等于5。 <code><a class="el" href="">getType()</a></code> 返回的标识符，表示错误数据包。 </p>

</div>
</div>
<a id="af92d9972a0c06888d9d035a474ce9811" name="af92d9972a0c06888d9d035a474ce9811"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af92d9972a0c06888d9d035a474ce9811">&#9670;&#160;</a></span>static let MIN_PACKET_SIZE</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.static let MIN_PACKET_SIZE = 4;</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>数据包的最小大小，为4个字节。足够存储操作码和块号或其他必需的数据，具体数据包大小取决于数据包类型。 </p>

</div>
</div>
<a id="a1b9d01dc44fc4d498b613e4c8f0b606d" name="a1b9d01dc44fc4d498b613e4c8f0b606d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1b9d01dc44fc4d498b613e4c8f0b606d">&#9670;&#160;</a></span>static let READ_REQUEST</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.static let READ_REQUEST = 1;</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>TFTP 规范标识符，等于1。 <code><a class="el" href="">getType()</a></code> 返回的标识符，表示读请求数据包。 </p>

</div>
</div>
<a id="ae23de23646555553bcebb5a748af38c5" name="ae23de23646555553bcebb5a748af38c5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae23de23646555553bcebb5a748af38c5">&#9670;&#160;</a></span>static let SEGMENT_SIZE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.static let SEGMENT_SIZE = 512;</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>TFTP 数据包的最大段大小，为 512 字节。 </p>

</div>
</div>
<a id="ae400dc7ae167e2886890feefe6b9385e" name="ae400dc7ae167e2886890feefe6b9385e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae400dc7ae167e2886890feefe6b9385e">&#9670;&#160;</a></span>static let WRITE_REQUEST</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.static let WRITE_REQUEST = 2;</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>TFTP 规范标识符，等于2。 <code><a class="el" href="">getType()</a></code> 返回的标识符，表示写请求数据包。 </p>

</div>
</div>
<a id="a52ba3da7a0bb6c6109adf8991feeba70" name="a52ba3da7a0bb6c6109adf8991feeba70"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a52ba3da7a0bb6c6109adf8991feeba70">&#9670;&#160;</a></span>var address</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.var address : String = &quot;&quot;;</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>数据包的目标或来源主机地址。 </p>

</div>
</div>
<a id="a07c6d1b18aac77659150f70b9ee91e96" name="a07c6d1b18aac77659150f70b9ee91e96"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a07c6d1b18aac77659150f70b9ee91e96">&#9670;&#160;</a></span>var packettype</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.var packettype : Int64 = 0;</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>数据包的类型。 </p>

</div>
</div>
<a id="af5ba7e699cd0b2c8cb2a70ab81bd800c" name="af5ba7e699cd0b2c8cb2a70ab81bd800c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af5ba7e699cd0b2c8cb2a70ab81bd800c">&#9670;&#160;</a></span>var port</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.tftp.TFTPPacket.var port : UInt16 = 0;</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>数据包的目标或来源使用的端口。 </p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>src/tftp/<a class="el" href="tftp__packet_8cj.html">tftp_packet.cj</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.9.6-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespacecommonsNet.html">commonsNet</a></li><li class="navelem"><a class="el" href="namespacecommonsNet_1_1tftp.html">tftp</a></li><li class="navelem"><a class="el" href="classcommonsNet_1_1tftp_1_1TFTPPacket.html">TFTPPacket</a></li>
    <li class="footer">制作者 <img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
  </ul>
</div>
</body>
</html>
